#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 灵芯派信息
"""
灵芯派基本信息读取示例
运行：uv run baseinfo.py
"""

from smartpi import base_driver

def read_all_info():
    """读取并格式化显示灵芯派基础信息"""
    device_model = base_driver.read_device_model()
    version      = base_driver.read_version()
    factory_data = base_driver.read_factory_data()
    hardware_id  = base_driver.read_hardware_ID()
    device_name  = base_driver.read_device_name()
    connected    = base_driver.read_connected()
    battery      = base_driver.read_battery()

    print("========== 灵芯派设备信息 ==========")
    print(f"设备型号 : {device_model}")
    print(f"固件版本 : {version}")
    print(f"厂家信息 : {factory_data}")
    print(f"硬件 ID  : {hardware_id}")
    print(f"设备名称 : {device_name}")
    print(f"连接方式 : {connected}")
    print(f"电池电量 : {battery}")
    print("===================================")

if __name__ == "__main__":
    base_driver.smartpi_init()
    read_all_info()